#include <bits/stdc++.h>
using namespace std;

const int N = 410;
typedef pair<int, int> PII;
int x, y, n, m;
int a[N][N];

int dx[8] = {1, 2, 2, 1, -1, -1, -2, -2};
int dy[8] = {2, 1, -1, -2, 2, -2, 1, -1};
void bfs()
{
    memset(a, -1, sizeof a);
    queue<PII> q;
    q.push({x, y});
    a[x][y] = 0;
    while(q.size())
    {
        auto t = q.front();
        q.pop();
        int i = t.first, j = t.second;
        for(int k = 0; k < 8; k++)
        {
            int x = i + dx[k], y = j + dy[k];
            if(x < 1 || x > n || y < 1 || y > m) continue;
            if(a[x][y] != -1) continue;

            a[x][y] = a[i][j] + 1;
            q.push({x, y});
        }
    }
}
int main()
{
    cin >> n >> m >> x >> y;

    bfs();
    
    for(int i = 1; i <= n; i++)
     {
         for(int j = 1; j <= m; j++)
         {
             printf("%-5d", a[i][j]);
         }
         cout << endl;
     }
            
    return 0;
}
